home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Texteditors
/
PolyEd
/
Macros
/
Tutorial
/
getattr.ped
< prev
next >
Wrap
Text File
|
1996-09-26
|
4KB
|
160 lines
/*
** $VER: getattr.ped 2.0 (23.2.95) written by Robert Brandner
**
** Demo of the the GETATTR command.
** This demo is well documentated, and should help you to use this
** mighty command.
*/
OPTIONS RESULTS
OPTIONS FAILAT 11 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
SIGNAL ON FAILURE
if (LEFT(ADDRESS(), 6) ~= "POLYED") then do
if SHOW("Ports", "POLYED.1") then
address 'POLYED.1'
else do
say "PolyEd is not running!"
exit
end
end
'LOCKGUI'
/*----- insert your code here ------------------------------------------*/
/* First, how to get all informations on the application:
** The informations are placed in nodes of the stem variable APP.
** If we wouldn't use a stem variable all informations would be placed
** into the variable RESULT, seperated by spaces.
*/
'GETATTR APPLICATION STEM APP.'
say "Informations about PolyEd"
say "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯"
say "Version :" APP.VERSION
say "Public Screen :" APP.SCREEN
say "Current Project:" APP.CURRENTPROJECT
say "Current Window :" APP.CURRENTWINDOW
say
say "Block Startline:" APP.VAR_BLOCKSTARTLINE
say "Block Startcol :" APP.VAR_BLOCKSTARTCOL
say "Block Endline :" APP.VAR_BLOCKENDLINE
say "Block Endcol :" APP.VAR_BLOCKENDCOL
say
say "Findstring :" APP.VAR_FINDSTRING
say "Changestring :" APP.VAR_CHANGESTRING
say "Ignore case? :" APP.FLAG_IGNORECASE
say "Whole words? :" APP.FLAG_WHOLEWORDS
say
say "Overwrite? :" APP.FLAG_OVERWRITE
say "Autoindent? :" APP.FLAG_AUTOINDENT
say "TAB as spaces? :" APP.FLAG_TABISSPACES
say "Wordwrap? :" APP.FLAG_WORDWRAP
say "Create Icons? :" APP.FLAG_CREATEICONS
say
say "Backups? :" APP.FLAG_BACKUPS
say "# Backups :" APP.VAR_BACKUPS
say "Autosave? :" APP.FLAG_AUTOSAVE
say "#changes :" APP.VAR_AUTOSAVE /* # of changes before autosave */
say "flash cursor? :" APP.FLAG_FLASHCURSOR
say
say "and so on..."
say "You may now ask for information of specific fields."
say "See documentation for the available fields."
say "To leave the loop, just press <return>"
say ""
OPTIONS prompt "application field> "
pull field
do while field ~= ""
'GETATTR APPLICATION FIELD' field
say field || ":" RESULT
say ""
pull field
end
/* Now we get a list of all projects */
OPTIONS PROMPT
say
say "Press <return> for a list of the projects:"
pull
say
'GETATTR PROJECTS STEM P.'
say "Here is a list of the" P.PROJECTS.COUNT "projects of PolyEd:"
say
do i=0 to P.PROJECTS.COUNT-1 /* from 0 to COUNT-1 ! */
say P.PROJECTS.i
say substr("", 1, length(P.PROJECTS.i), "¯") /* :^) */
/* Here we get the informations on one project into the stem variable PR.
** Variables must not be quoted, because ARexx does not evaluate them
** if they are.
*/
'GETATTR' PROJECT NAME P.PROJECTS.i STEM PR.
say 'complete filename :' PR.FILENAME
say 'file portion :' PR.FILE
say 'path portion :' PR.PATH
say 'modifications :' PR.CHANGES
say 'lines :' PR.LINES
say
end i
/*
** Now we fetch a list of all Text-Windows.
*/
'GETATTR WINDOWS STEM W.'
say "Here is a list of the" W.WINDOWS.COUNT "windows of PolyEd:"
say
do i=0 to W.WINDOWS.COUNT-1 /* from 0 to COUNT-1 ! */
say W.WINDOWS.i
/* Here we get the informations on one window into the stem variable W2.
** Variables must not be quoted, because ARexx does not evalute them
** if they are.
*/
'GETATTR' WINDOW '"'W.WINDOWS.i'"' STEM W2.
say 'project :' W2.PROJECT
say 'width :' W2.WIDTH
say 'height :' W2.HEIGHT
end i
/* Now a list of the macros */
say
say "Press <return> for a list of the macros:"
pull
say
'GETATTR MACROS STEM M.'
say "Here is a list of the" M.MACROS.COUNT "macros of PolyEd:"
say
do i=0 to M.MACROS.COUNT-1
say M.MACROS.i
end i
/*----- end of custom code area ----------------------------------------*/
'UNLOCKGUI'
EXIT
SYNTAX: /* ARexx error... */
say "Error line" SIGL ":" ERRORTEXT(RC) /* report it... */
'UNLOCKGUI' /* Unlock GUI! */
EXIT /* exit */
FAILURE:
'UNLOCKGUI' /* Unlock GUI! */
EXIT /* exit */